﻿<html>
<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=yes">
    <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>用户修改</title>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/ajz/mobile/css/iconfont.css?Timestamp=${Timestamp}">
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/ajz/mobile/css/mdialog.css?Timestamp=${Timestamp}">
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/sf.css?Timestamp=${Timestamp}"/>
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/index.css?Timestamp=${Timestamp}"/>
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/checkbox.css?Timestamp=${Timestamp}"/>
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/add_baseinfo.css?Timestamp=${Timestamp}"/>
    <script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/jquery.min.js?Timestamp=${Timestamp}"></script>
    <style>
        .imgContainer {
            width: 80%;
            height: 50%;
            margin-left: 10%;
        }

        .imgContainer img {
            width: 100%;
            height: 100%;
            display: inline-block;
        }
    </style>
</head>
<body>
<form name="updateQYInfo" id="updateQYInfo" method="post" action="${ctx}/ajz/ajzCompanyInfo/updateQYInfo">
    <div id="sacnboxs"></div>
    <hr class="line_hr_add">
    <h3 class="qy_t"><span class="qy_ba">&nbsp;</span> 基 础 信 息</h3>

    <ul class="table_information">
        <!-- 企业 -->
        <div class="aqsc">
            <!--<div class="imgContainer imgContainer_B"><span class="fontfamily Tin-cha">0</span></div>-->
            <!--enterprisePicture为营业执照，signboard为户外招牌-->
            <input class="aqsc" type="hidden" id="enterprisePictureUrl" name="enterprisePictureUrl">
            <input class="aqsc" type="hidden" id="signboardUrl" name="signboardUrl">
            <input class="aqsc" type="hidden" name="id" value="${ajzCompanyInfo.id}">
            <div class="aqsc">
                <h5 id="imgh5_1">营业执照识别
                </h5>
                <ul class="table_photo_min" id="updateimg">
                    <ol>
                        <div style="">
                            <div id="upBox">
                                <div id="inputBox">
                                    <input type="button" title="请选择图片" onclick="updateImg(this)"  value="true">上传
                                </div>
                                <div id="imgBox">
                                    <% if(ajzCompanyInfo.enterprisePicture!=null&&ajzCompanyInfo.enterprisePicture!=""){ %>
                                    <div class="imgContainer">
                                        <img src="${strutil.subString(ajzCompanyInfo.enterprisePicture,1)}" onclick="imgDisplay(this)">
                                    </div>
                                    <% } %>
                                </div>
                                <!--<span class="imgspan">注：请上传清晰图片</span>-->
                            </div>
                        </div>
                    </ol>
                </ul>
                <br><br>
                <!--<div class="hi_degbtnbar_iup bgcolor" style="text-align:center;">-->
                <!--<button type="button" onclick="getPicMsg();" class="table_btn xgbtn_1">识别</button>-->
                <!--</div>-->

                <hr class="line_hr_add aqsc">

                <h5 id="imgh5_1">户外招牌
                </h5>
                <ul class="table_photo_min" id="updateimg">
                    <ol>
                        <div style="">
                            <div id="upBox">
                                <div id="inputBox">
                                    <input type="button" title="请选择图片"  onclick="updateImg(this)"  value="false">上传
                                </div>
                                <div id="imgBox1">
                                    <% if(ajzCompanyInfo.signboard!=null&&ajzCompanyInfo.signboard!=""){ %>
                                    <div class="imgContainer">
                                        <img src="${strutil.subString(ajzCompanyInfo.signboard,1)}" onclick="imgDisplay(this)">
                                    </div>
                                    <% } %>
                                </div>
                                <!--<span class="imgspan">注：请上传清晰图片</span>-->
                            </div>
                        </div>
                    </ol>
                </ul>
            </div>


            <hr class="line_hr_add aqsc">

            <li class="aqsc"><i>所属社区：</i>
                <b>
                    <select name="office.officeCode">
                        <% for(office in officeList){ %>
                        <option value="${office.officeCode}">${office.officeName}</option>
                        <% } %>
                    </select>
                </b>
            </li>


            <li class="aqsc"><i>单位名称：</i><b><input type="text" class="table_text_box yczz_aqsc" id="enterpriseName"
                                                   name="enterpriseName" value="${ajzCompanyInfo.enterpriseName}"
                                                   placeholder="请输入营业执照名"
                                                   placeholder="请输入法定代表人姓名"></b><div class="must"></div></li>
                                                   <!--onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')"></b></li>-->
            <li class="aqsc"><i>营业执照：</i><b><input type="text" class="table_text_box num_aqsc" id="enterpriseNum" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'').toUpperCase()"
                                                   name="enterpriseNum" value="${ajzCompanyInfo.enterpriseNum}" onchange="checkEnterpriseNum()"
                                                   placeholder="请输入营业执照号码"></b><div class="must"></div></li>
            <li class="aqsc"><i>法人：</i><b><input type="text" class="table_text_box" id="legalPerson" name="legalPerson"
                                                 value="${ajzCompanyInfo.legalPerson}"
                                                 placeholder="请输入法定代表人姓名"></b></li>
            <li class="aqsc"><i>法人电话：</i><b><input type="text" class="table_text_box" name="legalPersonTel" maxlength=11
                                                   value="${ajzCompanyInfo.legalPersonTel}"
                                                   placeholder="请输入法人电话"></b></li>
            <li class="aqsc"><i>联系人：</i><b><input type="text" class="table_text_box username_aqsc" id="contactPerson"
                                                  name="contactPerson" value="${ajzCompanyInfo.contactPerson}"
                                                  placeholder="请输入联系人姓名"></b><div class="must"></div></li>
            <li class="aqsc"><i>联系电话：</i><b><input type="text" class="table_text_box cell_aqsc" name="contactPersonTel"
                                                   value="${ajzCompanyInfo.contactPersonTel}"
                                                   maxlength=11 placeholder="请输入安全管理员联系电话"
                                                   onKeyUp="value=value.replace(/\D/g,'')"
                                                   onafterpaste="value=value.replace(/\D/g,'')"></b><div class="must"></div></li>
            <li class="aqsc"><i>公司地址：</i><b><input type="text" class="table_text_box attr_aqsc" id="addr" name="addr"
                                                   value="${ajzCompanyInfo.addr}"
                                                   placeholder="请输入单位所在地址"></b><div class="must"></div></li>
            <li class="aqsc"><i>经营范围：</i><b><input type="text" class="table_text_box" name="buinessContent"
                                                   value="${ajzCompanyInfo.buinessContent}"
                                                   placeholder="请输入经营范围"></b></li>
            <li class="aqsc"><i>企业类型：</i><b><input type="text" class="table_text_box" name="enterpriseType"
                                                   value="${ajzCompanyInfo.enterpriseType}"
                                                   placeholder="请输入企业性质"></b></li>
            <li class="aqsc"><i>员工数量：</i><b><input type="text" class="table_text_box" name="empCount"
                                                   value="${ajzCompanyInfo.empCount}"
                                                   placeholder="请输入员工数量" onKeyUp="value=value.replace(/\D/g,'')"
                                                   onafterpaste="value=value.replace(/\D/g,'')"></b></li>
            <li class="aqsc"><i>企业面积：</i><b><input type="text" class="table_text_box" name="area" placeholder="请输入企业面积"
                                                   value="${ajzCompanyInfo.area}"></b>
            </li>
            <li class="aqsc"><i>年产值：</i><b><input type="text" class="table_text_box" name="yearValue" id="yearValue"
                                                  value="${ajzCompanyInfo.yearValue}"
                                                  placeholder="请输入企业年产值(单位:万元)"></b></li>
            <script>
                $("input[name='yearValue']").blur(function () {
                    if ($(this).val() >= 2000) {
                        $("#QY_nub option").eq(1).prop("selected", true)
                    } else {
                        $("#QY_nub option").eq(0).prop("selected", true)
                    }
                })
            </script>

            <li class="aqsc">
                <i>企业规模：</i>
                <b>
                    <select id="QY_nub" name="scale">
                        <option value="规下">规下</option>
                        <option value="规上">规上</option>
                        <option value="其他">其他</option>
                    </select>
                </b>
            </li>
            <li class="aqsc"><i>风险等级：</i>
                <b>
                    <select name="dangerLev">
                        <option value="三等风险">三等风险</option>
                        <option value="二等风险">二等风险</option>
                        <option value="一等风险">一等风险</option>
                    </select>
                </b>
            </li>
            <hr class="line_hr_add aqsc">
        </div>

    </ul>


    <h3 class="qy_t qy_t_box"><span class="qy_ba">&nbsp;</span>涉 及 类 型</h3>
    <div class="switch_Box_p">
        <li>
            <span class="switch_box_span">天然气</span>
            <div class="switch_box box_1">
                <input type="checkbox" class="switch_1" id="deadLine_trq">
            </div>
        </li>
        <li>
            <span class="switch_box_span">液化气</span>
            <div class="switch_box box_1">
                <input type="checkbox" class="switch_1" id="deadLine_yhq">
            </div>
        </li>
        <li>
            <span class="switch_box_span">食品安全</span>
            <div class="switch_box box_1">
                <input type="checkbox" class="switch_1" id="deadLine_spaq">
            </div>
        </li>

    </div>

    <ul class="table_information" style="margin:0px;padding: 0px;">
        <li class="trq"><i>天然气性质：</i>
            <input type="hidden" value="0">
            <b>
                <select class="trq_rqse" name="ajzNaturalGas.naturalGasNature">
                    <option value="1">营业用户</option>
                    <option value="2">民用户</option>
                </select>
            </b>
        </li>
        <li class="trq">
            <i>天然气合同：</i>
            <b><input style="width: 67%" type="text" name="ajzNaturalGas.naturalGasContract" class="table_text_box"
                      id="naturalGasContract"
                      value="${ajzCompanyInfo.ajzNaturalGas.naturalGasContract!}" placeholder="请输入天然气合同编号"><input
                    type="hidden" value="0"></b></li>

        <li class="yhq"><i>液化气性质：</i>
            <input type="hidden" value="0">
            <b>
                <select class="rqse" name="ajzLiquefiedGas.liquefiedGasNature">
                    <option value="1">营业用户</option>
                    <option value="2">民用户</option>
                </select>
            </b>
        </li>
        <li class="yhq">
            <i>液化气合同：</i>
            <b><input style="width: 67%" type="text" name="ajzLiquefiedGas.liquefiedGasContract" class="table_text_box"
                      id="liquefiedGasContract"
                      value="${ajzCompanyInfo.ajzLiquefiedGas.liquefiedGasContract!}" placeholder="请输入液化气合同编号"><input
                    type="hidden" value="0"></b></li>

        <li class="spaq">
            <i>健康证：</i>
            <b><input style="width: 67%" type="text" name="ajzFoodSafety.healthCertificate" class="table_text_box"
                      id="healthCertificate"
                      value="${ajzCompanyInfo.ajzFoodSafety.healthCertificate!}" placeholder="请输入健康证号码"><input
                    type="hidden" value="0"></b></li>
    </ul>
    <hr class="line_hr_add">

    <div class="hi_degbtnbar_iup btn_box_bgcolor">
        <a href="javascript:history.go(-1);" class="xgbtn_a_3" style="">返 回</a>
        <!--<input type="submit" name="" value="提 交" class="table_btn xgbtn_a_4" id="btn_paicha">-->
        <a href="javascript:void(0)" class="table_btn xgbtn_a_4" id="btn_paicha" onclick="sub()">提 交</a>
    </div>
</form>
<%
include("/layouts/mask.html"){}
%>
<script type="text/javascript" src='${ctxStatic}/ajz/mobile/js/add_baseinfo.js?Timestamp=${Timestamp}'></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/vue.min.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/zepto.min.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/mdialog.js?Timestamp=${Timestamp}"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/ajz/mobile/js/add_wxpic.js?Timestamp=${Timestamp}" ></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/ajz/mobile/js/sf.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript">

    wx.config({
        debug: false,
        appId: '${appId}',
        timestamp: '${timestamp}',
        nonceStr: '${nonceStr}',
        signature: '${signature}',
        jsApiList: [
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'scanQRCode'
        ]
    });

    /*给图片上传绑定动态按钮*/
    function updateImg(tin){
        var btnId = $(tin).parent().next().attr('id');//获取当前元素的父元素的下一个元素
        var inputVal = $(tin).attr('value');//获取当前点击元素的vlaue
        upload(btnId,inputVal);
    }



    //获取下拉框的值并选中对应的值
    var officeCode = '${ajzCompanyInfo.office.officeCode}';
    $("select[name='office.officeCode'] option[value=" + officeCode + "]").prop("selected", "selected");
    var scale = '${ajzCompanyInfo.scale}';
    $("select[name='scale'] option[value=" + scale + "]").prop("selected", "selected");
    var dangerLev = '${ajzCompanyInfo.dangerLev}';
    $("select[name='dangerLev'] option[value=" + dangerLev + "]").prop("selected", "selected");

    //天然气等其他类别
    //天然气合同
    var naturalGasContract = '${ajzCompanyInfo.ajzNaturalGas.naturalGasContract!}';
    //天然气性质
    var naturalGasNature = '${ajzCompanyInfo.ajzNaturalGas.naturalGasNature!}';
    if (naturalGasContract) {
        $("#deadLine_trq").prop("checked", "checked");
        $(".trq").css("display", "block");
        //天然气性质下拉选默认值
        $("select[name='ajzNaturalGas.naturalGasNature'] option[value=" + naturalGasNature + "]").prop("selected", "selected");
    }

    //液化气
    //液化气合同
    var liquefiedGasContract = '${ajzCompanyInfo.ajzLiquefiedGas.liquefiedGasContract!}';
    //液化气性质
    var liquefiedGasNature = '${ajzCompanyInfo.ajzLiquefiedGas.liquefiedGasNature!}';
    if (liquefiedGasContract) {
        //液化气性质下拉选默认值
        $("select[name='ajzLiquefiedGas.liquefiedGasNature'] option[value=" + liquefiedGasNature + "]").prop("selected", "selected");
        $("#deadLine_yhq").prop("checked", "checked");
        $(".yhq").css("display", "block");
    }
    //食品安全
    var healthCertificate = '${ajzCompanyInfo.ajzFoodSafety.healthCertificate!}';
    if (healthCertificate != "") {
        $("#deadLine_spaq").prop("checked", "checked");
        $(".spaq").css("display", "block");
    }


    //默认为不可提交
    var canSumbit = 0;

    //根据营业执照号码判断是否已存在商家
    function checkEnterpriseNum() {
        var enterpriseNum = $("#enterpriseNum").val();
        if (enterpriseNum != "" && enterpriseNum != null) {
            $.ajax({
                url: "${ctx}/ajz/ajzCompanyInfo/checkEnterpriseNum",
                type: "POST",
                data: "enterpriseNum=" + enterpriseNum,
                dataType: "json",
                success: function (ajzCompanyInfo) {
                    new TipBox({type: 'error', str: '已存在此商家!', hasBtn: true});
                    canSumbit = 1;
                }, error: function () {
                    canSumbit = 0;
                }
            });
        }
    }


    //验证并提交
    function sub() {
        /*验证营业执照号是否存在*/
        if (canSumbit == 1) {
            new TipBox({type: 'error', str: '该商家已存在，请检查是否输入正确!', hasBtn: true});
            return false;
        }
        /*验证必填项*/
        if ($(".yczz_aqsc").val() == "") {
            $(".yczz_aqsc").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请输入单位名称', hasBtn: true});
            return false
        }
        else if($(".num_aqsc").val()==""){
            $(".num_aqsc ").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请输入营业执照号码', hasBtn: true});
            return false
        }
        else if ($(".username_aqsc ").val() == "") {
            $(".username_aqsc ").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写联系人姓名', hasBtn: true});
            return false
        }
        else if ($(".cell_aqsc").val() == "") {
            $(".cell_aqsc").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写联系电话', hasBtn: true});
            return false
        }
        else if ($(".attr_aqsc").val() == "") {
            $(".attr_aqsc").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写所在地址', hasBtn: true});
            return false
        } else {
            //开启遮罩并提交
            VerifyAndsubmit("updateQYInfo");
        }
    }

    // new TipBox({type:'success',str:'操作成功',hasBtn:true}); //成功
    // new TipBox({type:'error',str:'对不起,出错了!',hasBtn:true});  //错误
    // new TipBox({type:'tip',str:'这是提示信息',clickDomCancel:true,setTime:10000500,hasBtn:true});   //提示
    // new TipBox({type:'load',str:"努力加载中..",setTime:1500,callBack:function(){    //加载
    // new TipBox({type:'success',str:'操作成功',hasBtn:true});
    // }});

    //图片到后台解析，后去返回的营业执照信息
    /* function getPicMsg() {
         var pic = $("#enterprisePicture").val();

         if (pic == "" || pic == null) {
             alert("请上传图片");
             return false;
         }
         $.ajax({
             url: "${ctx}/ajz/ajzBaseinfo/getBLiscenseMsg",
             type: "POST",
             data: "pic=" + pic,
             dataType: "json",
             success: function (result) {
                 var list = result.words_result;
                 console.log(list);
                 //营业执照信息插入输入框
                 var enterpriseName = list["单位名称"].words;
                 var legalPerson = list["法人"].words;
                 var enterpriseNum = list["社会信用代码"].words;
                 var addr = list["地址"].words;


                 $('#enterpriseName').val(enterpriseName);
                 $('#legalPerson').val(legalPerson);
                 $('#contactPerson').val(legalPerson);
                 $('#enterpriseNum').val(enterpriseNum);
                 $('#addr').val(addr);

                 // checkEnterpriseName();
             }
         });
     }*/
</script>
</body>
</html>



